/*
 * @Author: Jimmy
 * @LastModifiedBy: Jimmy
 * @Date: 2024-05-25 16:45:34
 * @LastEditTime: 2024-06-29 10:21:13
 * @FilePath: /nest_study/server/src/modules/system/dept/entities/dept.entity.ts
 */
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { BaseEntity } from 'src/common/entites/base';

@Entity('sys_dept', {
    comment: '部门表',
})
export class SystemDeptEntity extends BaseEntity {
    @ApiProperty({ type: String, description: '部门ID' })
    @PrimaryGeneratedColumn({ name: 'dept_id', comment: '部门ID' })
    public id: number;

    @ApiProperty({ type: Number, description: '父部门ID' })
    @Column({ type: 'int', name: 'parent_id', default: -1, comment: '父部门ID' })
    public parentId: number;

    @Column({ type: 'varchar', name: 'ancestors', length: 50, default: '0', comment: '祖级列表' })
    public ancestors: string;

    @Column({ type: 'varchar', name: 'dept_name', length: 30, comment: '部门名称' })
    public name: string;

    @Column({ type: 'int', name: 'order_num', default: 0, comment: '显示顺序' })
    public sort: number;

    @Column({ type: 'varchar', name: 'leader', length: 20, comment: '负责人' })
    public leader: string;

    @ApiProperty({ type: String, description: '联系电话' })
    @Column({ type: 'varchar', name: 'phone', default: '', length: 11, comment: '联系电话' })
    public phone: string;

    @ApiProperty({ type: String, description: '邮箱' })
    @Column({ type: 'varchar', name: 'email', length: 50, default: '', comment: '邮箱' })
    public email: string;
}